package com.kl.forum.api;


import com.kl.forum.service.PunchClockService;
import com.kl.forum.util.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api("打卡")
@RestController
@RequestMapping("/punch")
public class PunchClockControllerAPI {
    @Autowired
    private PunchClockService punchClockService;

    /**
     *  晨起打卡
     * @param userId
     * @param
     * @param
     * @return
     */
    @ApiOperation(value = "晨起打卡界面",notes="")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户Id", required = false, dataType = "Long"),
            @ApiImplicitParam(name = "configId", value = "赛事类型ID", required = true, dataType = "Long"),
    })
    @RequestMapping(value = "/punchClock",method= RequestMethod.GET)
    public ResultInfo punchClock(@RequestParam(value = "userId",required = false) Integer userId ,Integer configId){
        return punchClockService.punchClock(userId,configId);
    }




    /**
     *  报名
     * @param userId
     * @param
     * @param
     * @return
     */
    @ApiOperation(value = "报名",notes="")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户Id", required = true, dataType = "Long"),
            @ApiImplicitParam(name = "configId", value = "赛事类型ID", required = true, dataType = "Long"),
            @ApiImplicitParam(name = "matchId", value = "赛事ID", required = true, dataType = "Long"),

    })
    @RequestMapping(value = "/addClock",method= RequestMethod.POST)
    public ResultInfo addClock(@RequestParam(value = "userId",required = false) Integer userId ,Integer configId,Integer matchId){
        return punchClockService.addClock(userId,configId,matchId);
    }

    /**
     *  打卡
     * @param userId
     * @param
     * @param
     * @return
     */
    @ApiOperation(value = "打卡",notes="")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户Id", required = true, dataType = "Long"),
            @ApiImplicitParam(name = "configId", value = "赛事类型ID", required = true, dataType = "Long"),
            @ApiImplicitParam(name = "matchId", value = "赛事ID", required = true, dataType = "Long"),

    })
    @RequestMapping(value = "/clockIn",method= RequestMethod.POST)
    public ResultInfo clockIn(@RequestParam(value = "userId",required = false) Integer userId ,Integer configId,Integer matchId){
        return punchClockService.clockIn(userId,configId,matchId);
    }


    /**
     *  通知
     * @param userId
     * @param
     * @param
     * @return
     */
    @ApiOperation(value = "通知",notes="")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户Id", required = true, dataType = "Long"),
            @ApiImplicitParam(name = "matchId", value = "活动Id", required = true, dataType = "Long")
    })
    @RequestMapping(value = "/addNotice",method= RequestMethod.POST)
    public ResultInfo addNotice(@RequestParam(value = "userId",required = true) Integer userId,Integer matchId ){
        return punchClockService.addNotice(userId,matchId);
    }


    /**
     * 活动列表
     * @return
     */
    @ApiOperation(value = "活动列表",notes="")
    @ApiImplicitParams({

    })
    @RequestMapping(value = "/findPunchClockGame",method= RequestMethod.GET)
    public ResultInfo findPunchClockGame(){
        return punchClockService.findPunchClockGame();
    }

    /**
     * 我参加的赛事列表
     * @return
     */
    @ApiOperation(value = "我参加的赛事列表",notes="")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户Id", required = true, dataType = "Long"),
            @ApiImplicitParam(name = "configId", value = "赛事类型ID", required = true, dataType = "Long"),
            @ApiImplicitParam(name = "pageNum", value = "页数", required = true, dataType = "Long"),
            @ApiImplicitParam(name = "pageSize", value = "每页大小", required = true, dataType = "Long"),

    })
    @RequestMapping(value = "/findMyPunchMatch",method= RequestMethod.GET)
    public ResultInfo findMyPunchMatch(@RequestParam(value = "userId",required = false) Integer userId,Integer configId,Integer pageNum,Integer pageSize){
        return punchClockService.findMyPunchMatch(userId,configId,pageNum,pageSize);
    }




}
